LIBLCOM_A = liblcom/liblcom.a
CFLAGS = -Wall -g -Iliblcom

ALEXK_EXE = alexk.exe

C_SRC = heap.c main.c window.c physics.c input.c level.c bg.c alexkidd.c enemies.c sound.c xpm.c anim.c menu.c game.c bigxpm.c boss.c
C_OBJ= $(C_SRC:.c=.o)
ASM_SRC = kbc_isr.asm t0_isr.asm
ASM_OBJ= $(ASM_SRC:.asm=.o)

.PHONY: all tests tests-clean liblcom

all: $(ALEXK_EXE)

liblcom:
	cd liblcom
	$(MAKE)
	cd ..


$(LIBLCOM_A):
	cd liblcom
	$(MAKE)
	cd ..


%.o: $(wildcard *.h)
%.o: %.c
	gcc $(CFLAGS) -c $<


%_isr.o: %_isr.asm
	nasm -t -f coff $<

	

%_asm.o: %_asm.asm
	nasm -t -f coff $<

$(ALEXK_EXE): $(C_OBJ) $(ASM_OBJ) $(LIBLCOM_A)
	gcc -Wall -o $@ $(C_OBJ) $(ASM_OBJ) $(LIBLCOM_A)


clean:
	rm $(C_OBJ)
	rm $(ASM_OBJ)
	rm $(ALEXK_EXE)

tests: $(C_OBJ) $(ASM_OBJ) $(LIBLCOM_A)
	cd tests
	$(MAKE)


tests-clean:
	cd tests
	$(MAKE) clean

rebuild:
	cd liblcom
	$(MAKE) clean
	cd ..
	$(MAKE) clean
	$(MAKE)

sprite.o: sprite.h sprite.c

main.o: main.c pixmap.h global.h

window.o: window.h heap.h

heap: heap.h
physics: physics.h physics.c







